package com.itheima.TCP.TCP接收协议;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

public class ServerDemo2 {
    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(10000);
        Socket s = ss.accept();//等待客户端连接

        InputStream is = s.getInputStream();
        int b;
        while ((b=is.read())!=-1){
            System.out.println((char)b);
        }
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(s.getOutputStream()));
        bw.write("b");
        bw.newLine();
        bw.flush();

        bw.close();
        is.close();
        s.close();
        ss.close();

    }
}
